From 3d410dc987bf6fd6d38e4370c917163109bba7d2 Mon Sep 17 00:00:00 2001 From: oliskoli Date: Wed, 6 Jun 2007 22:34:47 +0000 Subject: [PATCH] Welcome "html" in the world of gbfile. --- html.c | 94 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/html.c b/html.c index ba8390d83..fa4abb7b8 100644 --- a/html.c +++ b/html.c @@ -24,7 +24,7 @@ #include "jeeps/gpsmath.h" #include -static FILE *file_out; +static gbfile *file_out; static short_handle mkshort_handle; static char *stylesheet = NULL; @@ -55,14 +55,14 @@ arglist_t html_args[] = { static void wr_init(const char *fname) { - file_out = xfopen(fname, "w", MYNAME); + file_out = gbfopen(fname, "w", MYNAME); mkshort_handle = mkshort_new_handle(); } static void wr_deinit(void) { - fclose(file_out); + gbfclose(file_out); mkshort_del_handle(&mkshort_handle); } @@ -86,51 +86,51 @@ html_disp(const waypoint *wpt) strftime(tbuf, sizeof(tbuf), "%d-%b-%Y", localtime(&tm)); - fprintf(file_out, "\n
\n", wpt->shortname); - fprintf(file_out, "\n"); - fprintf(file_out, "

%s - ",(global_opts.synthesize_shortnames) ? mkshort_from_wpt(mkshort_handle, wpt) : wpt->shortname); + gbfprintf(file_out, "\n


\n", wpt->shortname); + gbfprintf(file_out, "\n"); + gbfprintf(file_out, "\n"); + gbfprintf(file_out, "

\n"); - fprintf (file_out, "\n"); + gbfprintf(file_out, "\n"); - fprintf(file_out, "

%s - ",(global_opts.synthesize_shortnames) ? mkshort_from_wpt(mkshort_handle, wpt) : wpt->shortname); cout = pretty_deg_format(wpt->latitude, wpt->longitude, degformat[2], 1); - fprintf(file_out, "%s (%d%c %6.0f %7.0f)", cout, utmz, utmzc, utme, utmn); + gbfprintf(file_out, "%s (%d%c %6.0f %7.0f)", cout, utmz, utmzc, utme, utmn); xfree (cout); if (wpt->altitude != unknown_alt) - fprintf (file_out, " alt:%d", (int) ( (altunits[0]=='f')?METERS_TO_FEET(wpt->altitude):wpt->altitude) ); - fprintf (file_out, "
\n"); + gbfprintf (file_out, " alt:%d", (int) ( (altunits[0]=='f')?METERS_TO_FEET(wpt->altitude):wpt->altitude) ); + gbfprintf (file_out, "
\n"); if (strcmp(wpt->description, wpt->shortname)) { if (wpt->url) { char *d = html_entitize(wpt->description); - fprintf(file_out, "%s", wpt->url, d); + gbfprintf(file_out, "%s", wpt->url, d); xfree(d); } else { - fprintf(file_out, "%s", wpt->description); + gbfprintf(file_out, "%s", wpt->description); } if (wpt->gc_data.placer) { - fprintf(file_out, " by %s", wpt->gc_data.placer); + gbfprintf(file_out, " by %s", wpt->gc_data.placer); } } - fprintf(file_out, "

"); + gbfprintf (file_out, ""); if (wpt->gc_data.terr) { - fprintf (file_out, "

%d%s / %d%s
\n", + gbfprintf (file_out, "

%d%s / %d%s
\n", (int)(wpt->gc_data.diff / 10), (wpt->gc_data.diff%10)?"½":"", (int)(wpt->gc_data.terr / 10), (wpt->gc_data.terr%10)?"½":"" ); - fprintf(file_out, "%s / %s

", + gbfprintf(file_out, "%s / %s

", gs_get_cachetype(wpt->gc_data.type), gs_get_container(wpt->gc_data.container)); } - fprintf(file_out, "
"); + gbfprintf(file_out, "
"); if (wpt->gc_data.desc_short.utfstring) { char *tmpstr = strip_nastyhtml(wpt->gc_data.desc_short.utfstring); - fprintf (file_out, "

%s

\n", tmpstr ); + gbfprintf (file_out, "

%s

\n", tmpstr ); xfree( tmpstr ); } if (wpt->gc_data.desc_long.utfstring) { char *tmpstr = strip_nastyhtml(wpt->gc_data.desc_long.utfstring); - fprintf (file_out, "

%s

\n", tmpstr ); + gbfprintf (file_out, "

%s

\n", tmpstr ); xfree( tmpstr ); } if (wpt->gc_data.hint) { @@ -139,11 +139,11 @@ html_disp(const waypoint *wpt) hint = rot13( wpt->gc_data.hint ); else hint = xstrdup( wpt->gc_data.hint ); - fprintf (file_out, "

Hint: %s

\n", hint); + gbfprintf (file_out, "

Hint: %s

\n", hint); xfree( hint ); } else if (wpt->notes && (!wpt->description || strcmp(wpt->notes,wpt->description))) { - fprintf (file_out, "

%s

\n", wpt->notes); + gbfprintf (file_out, "

%s

\n", wpt->notes); } fs_gpx = NULL; @@ -159,17 +159,17 @@ html_disp(const waypoint *wpt) while ( curlog ) { time_t logtime = 0; struct tm *logtm = NULL; - fprintf( file_out, "

\n" ); + gbfprintf( file_out, "

\n" ); logpart = xml_findfirst( curlog, "groundspeak:type" ); if ( logpart ) { - fprintf( file_out, "%s by ", logpart->cdata ); + gbfprintf( file_out, "%s by ", logpart->cdata ); } logpart = xml_findfirst( curlog, "groundspeak:finder" ); if ( logpart ) { char *f = html_entitize( logpart->cdata ); - fprintf( file_out, "%s on ", f ); + gbfprintf( file_out, "%s on ", f ); xfree( f ); } @@ -178,7 +178,7 @@ html_disp(const waypoint *wpt) logtime = xml_parse_time( logpart->cdata, NULL); logtm = localtime( &logtime ); if ( logtm ) { - fprintf( file_out, + gbfprintf( file_out, "%04d-%02d-%02d
\n", logtm->tm_year+1900, logtm->tm_mon+1, @@ -200,7 +200,7 @@ html_disp(const waypoint *wpt) lon = atof( coordstr ); } coordstr = pretty_deg_format(lat, lon, degformat[2], 1); - fprintf( file_out, + gbfprintf( file_out, "%s
\n", coordstr ); xfree(coordstr); @@ -223,16 +223,16 @@ html_disp(const waypoint *wpt) } t = html_entitize( s ); - fprintf( file_out, "%s", t ); + gbfprintf( file_out, "%s", t ); xfree( t ); xfree( s ); } - fprintf( file_out, "

\n" ); + gbfprintf( file_out, "

\n" ); curlog = xml_findnext( root, curlog, "groundspeak:log" ); } } - fprintf(file_out, "
\n"); + gbfprintf(file_out, "
\n"); } static void @@ -241,7 +241,7 @@ html_index(const waypoint *wpt) char *sn = html_entitize(wpt->shortname); char *d = html_entitize(wpt->description); - fprintf(file_out, "%s - %s
\n", sn, sn, d); + gbfprintf(file_out, "%s - %s
\n", sn, sn, d); xfree(sn); xfree(d); @@ -252,30 +252,30 @@ data_write(void) { setshort_length(mkshort_handle, 6); - fprintf(file_out, "\n"); - fprintf(file_out, "\n"); - fprintf(file_out, "\n"); - fprintf(file_out, " \n"); - fprintf(file_out, " \n", gpsbabel_version); - fprintf(file_out, " GPSBabel HTML Output\n"); + gbfprintf(file_out, "\n"); + gbfprintf(file_out, "\n"); + gbfprintf(file_out, "\n"); + gbfprintf(file_out, " \n"); + gbfprintf(file_out, " \n", gpsbabel_version); + gbfprintf(file_out, " GPSBabel HTML Output\n"); if (stylesheet) - fprintf(file_out, " \n", stylesheet); + gbfprintf(file_out, " \n", stylesheet); else { - fprintf(file_out, " \n"); + gbfprintf(file_out, " \n"); } - fprintf(file_out, "\n"); - fprintf(file_out, "\n"); + gbfprintf(file_out, "\n"); + gbfprintf(file_out, "\n"); - fprintf(file_out, "

\n"); + gbfprintf(file_out, "

\n"); waypt_disp_all(html_index); - fprintf(file_out, "

\n"); + gbfprintf(file_out, "

\n"); waypt_disp_all(html_disp); - fprintf(file_out, ""); - fprintf(file_out, ""); + gbfprintf(file_out, ""); + gbfprintf(file_out, ""); } -- 2.30.2